package com.youths.controller;

import com.youths.response.Result;
import com.youths.service.ExpertInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Role;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/")
@Slf4j
@RestController
public class ExpertInfoController {

    @Autowired
    ExpertInfoService expertInfoService;

    @GetMapping("/back/getExpertInfoList")
    @ResponseBody
    public Result getExpertInfolist(@RequestParam("pageNum") Integer pageNum,
                                    @RequestParam("expertId") Integer expertId,
                                    @RequestParam("consumerId") Integer consumerId,
                                    @RequestParam("name") String name,
                                    @RequestParam("company") String company,
                                    @RequestParam("title") String title){
        return Result.success(expertInfoService.getExpertInfoList(pageNum,expertId,consumerId,name,company,title));
    }

    @PostMapping("/back/updateExpertInfo")
    @ResponseBody
    public Result updateExpertInfo(@RequestParam("expertId") Integer expertId,
                                   @RequestParam("consumerId") Integer consumerId,
                                   @RequestParam("name") String name,
                                   @RequestParam("company") String company,
                                   @RequestParam("title") String title,
                                   @RequestParam("state") Integer state){
        return Result.success(expertInfoService.updateExpertInfo(expertId,consumerId,name,company,title,state));
    }
}
